/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - system/task
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEScheduler.h
// Author:		Gianluca Belardelli
// Date:		30/06/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AESCHEDULER_H_
#define _AESCHEDULER_H_

/// \brief Classe che si occupa di schedulare l'esecuzione di tutti i task.
class AEScheduler
{
// Members
protected:
	typedef AETMap<AEUINT32, AESystemSceneI *>	AESceneExecs;

    static const AEFLOAT32			sm_fDefaultClockFrequency;
	AETaskManager					*m_lpTaskManager;

    AEFLOAT32						m_fClockFrequency;
    AEHANDLE						m_hExecutionTimer;

    AEBOOL32						m_bBenchmarkingEnabled;
    AEBOOL32						m_bThreadingEnabled;

    AESceneExecs					*m_mapSceneExecs;

// Methods
public:
    /// <summary>
    ///   Constructor.
    /// </summary>
    /// <param name="pTaskManager">A pointer to the task manager.</param>
	AEScheduler( AETaskManager *lpTaskManager );

    /// <summary>
    ///   Destructor.
    /// </summary>
    ~AEScheduler( void );

    /// <summary>
    ///   Turns benchmarking on or off.
    /// </summary>
    void EnableBenchmarking( AEBOOL32 bEnable=1 ) { m_bBenchmarkingEnabled = bEnable; }

    /// <summary>
    ///   Turns threading on or off.
    /// </summary>
    void EnableThreading( AEBOOL32 bEnable=1 ) { m_bThreadingEnabled = bEnable; }

    /// <summary>
    ///   Sets the UScene to schedule execution of.
    /// </summary>
    /// <param name="pScene">A pointer to the universal scene.</param>
    //void SetScene( const UScene* pScene );

    /// <summary>
    ///   Execute the set UScene.
    /// </summary>
    void Execute( void );
};

#endif // _AESCHEDULER_H_
